#pragma once
#ifndef __TESTCANDIDATE__H__
#define __TESTCANDIDATE__H__

#include "ATTest.h"

class CandidateTestCase : public TestCase
{
public:
	CandidateTestCase(const Char* pszName) : TestCase(pszName)
	{
		Add(NEW_TEST(CandidateTestCase::TestCreatCandidate));
		Add(NEW_TEST(CandidateTestCase::TestRemove));
		Add(NEW_TEST(CandidateTestCase::TestRemove2));
	}
	~CandidateTestCase()
	{
	}

	int TestCreatCandidate()
	{
		ATSudokuEngine::Candidate aCandidate(9);

		return 0;
	}

	int TestRemove()
	{
		ATSudokuEngine::Candidate aCandidate(9);

		ATASSERT(aCandidate.Remove(3));
		ATASSERT(aCandidate.Remove(5));
		ATASSERT(False == aCandidate.Remove(5));

		return 0;
	}

	int TestRemove2()
	{
		ATSudokuEngine::Candidate aCandidate(9);

		ATSudokuEngine::CandidateIterator itStart = aCandidate.BeginCandidates();

		for(; itStart!=aCandidate.EndCandidates(); )
		{
			if(*itStart == 3)
				itStart = aCandidate.Remove(itStart);
			else
				++itStart;
		}

		return 0;
	}

	int TestAdd()
	{
		ATSudokuEngine::Candidate aCandidate(9);

		ATASSERT(aCandidate.Remove(3));
		ATASSERT(aCandidate.Remove(5));
		ATASSERT(False == aCandidate.Remove(5));

		ATASSERT(aCandidate.Add(3));
		ATASSERT(aCandidate.Add(5));
		ATASSERT(False == aCandidate.Add(3));
		ATASSERT(False == aCandidate.Add(4));
		ATASSERT(False == aCandidate.Add(5));
		return 0;
	}
};

#endif